<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 
          new执行过程
            1.后面跟着函数名（），调用了构造函数
            2.创建了一个空对象，this就是对象名
            3.给当前对象动态添加属性和方法
            4.返回这个对象
        */
        function Music(name,genre,song,lyric){
        this.genre=genre;
        this.name=name;
        this.lyric=lyric;
        this.song=function(song){
            console.log(song);
        }
       }
       let jayChou=new Music('周杰伦','流行','七里香','窗外的麻雀');
       console.log(jayChou);
       console.log(jayChou.name);
       console.log(jayChou['lyric']);
       jayChou.song('在电线杆上多嘴');
    </script>
</body>
</html>